function urlReplaceDomain(newDomain,url){
	return (url||location.href).replace(/(.+:\/\/).+?(\/.+)/,"$1"+newDomain+"$2");
}
function urlGetDirectory(url){return (url||location.href).match(/.+\//)[0]}

function addBASE(html,href){
	return html.replace(/(<head>)/i,"$1\n<BASE href='"+urlGetDirectory(href)+"' />\n");
}